﻿Imports DAO

Public Class frmDangNhap

    Public Sub btnDangNhap_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDangNhap.Click, MyBase.Enter
        Dim query As String
        Dim user As String
        Dim dt As DataTable
        Dim DTP As New DataProvider()

        Try
            user = txttendangnhap.Text
        Catch ex As Exception
            MessageBox.Show("Khong Nhap ky tu dac biet")
            Return
        End Try



        query = " select User,Pass from NGUOIDUNG where User='" + user + "'  "
        dt = DTP.Datatable_PHONGMACHTU(query)

        If (dt.Rows.Count = 1) Then
            If (txttendangnhap.Text = dt.Rows(0)("User") And txtmatkhau.Text = dt.Rows(0)("Pass")) Then
                frmChinh.ShowDialog()
            Else
                MessageBox.Show("Dang Nhap Sai")
            End If

        Else
            MessageBox.Show("Dang Nhap Khong Thanh Cong")
        End If

    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        Me.Close()
    End Sub

    Private Sub frmDangNhap_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles MyBase.KeyPress



    End Sub
End Class